/**
 * @Date 2020-06-28 14:46:37
 * @Remark
 */

// lib
// config
// script & methods & public
// http
// service
import {
  simplePageService,
  simpleObjectService,
  simpleBooleanService,
  simpleListService,
} from "@/public/service/simple.service";
import store from "@/store";
// api
import {
  ReqMemberListPage,
  ResMemberListPage,
  API_MEMBERLIST_PAGE,
  ReqMemberListAdd,
  API_MEMBERLIST_ADD,
  ResMemberListAdd,
  API_MEMBERLIST_UPDATE,
  ReqMemberListUpdate,
  ResMemberListUpdate,
  API_MEMBERLIST_DEL,
  ReqMemberListDel,
  ResMemberListDel,
  API_MEMBERLIST_FINDALLCLASS,
  ReqMemberListFindAllClass,
  ResMemberListFindAllClass,
  API_MEMBERLIST_LEVEL,
  ReqMemberListFindAllLevel,
  ResMemberListFindAllLevel,
  API_MEMBERLIST_DISABLED,
  ReqMemberListDisabled,
  ResMemberListDisabled,
  API_MEMBERLIST_RELEASEACTIVITY,
  ReqReleaseActivityCount,
  ResReleaseActivityCount,
  API_MEMBERLIST_RELEASEARTICLE,
  ReqReleaseArticleCount,
  ResReleaseArticleCount,
  API_MEMBERLIST_PARTICIPATEACTIVITY,
  ReqParticipateActivityCount,
  ResParticipateActivityCount,
  API_MEMBERLIST_GETINFO,
  ReqMemberListGetInfo,
  ResMemberListGetInfo,
} from "./api";
// interface && type && class
import { MemberListDto } from "./model";
// 其它

// 活动分页
export async function getMemberListPageService(params: ReqMemberListPage) {
  return simplePageService<ReqMemberListPage, ResMemberListPage, MemberListDto>(
    API_MEMBERLIST_PAGE,
    params,
  );
}
// 活动添加
export async function addMemberListService(params: ReqMemberListAdd) {
  return simpleObjectService<ReqMemberListAdd, ResMemberListAdd, MemberListDto>(
    API_MEMBERLIST_ADD,
    params,
  );
}

// 活动编辑
export async function updateMemberListService(params: ReqMemberListUpdate) {
  return simpleObjectService<ReqMemberListUpdate, ResMemberListUpdate, MemberListDto>(
    API_MEMBERLIST_UPDATE,
    params,
  );
}

// 活动删除
export async function delMemberListService(id: number) {
  return simpleBooleanService<ReqMemberListDel, ResMemberListDel>(API_MEMBERLIST_DEL, {
    id,
  });
}

// 获取所以会员类型
export async function getActivityClassService() {
  return simpleListService<ReqMemberListFindAllClass, ResMemberListFindAllClass, MemberListDto>(
    API_MEMBERLIST_FINDALLCLASS,
    {},
  );
}

// 获取所以会员类型
export async function getMemberLevelService() {
  return simpleListService<ReqMemberListFindAllLevel, ResMemberListFindAllLevel, MemberListDto>(
    API_MEMBERLIST_LEVEL,
    {},
  );
}

// 修改状态update
export async function updateMemberListDisabledService(params: ReqMemberListDisabled) {
  return simpleBooleanService<ReqMemberListDisabled, ResMemberListDisabled>(
    API_MEMBERLIST_DISABLED,
    params,
  );
}

// 发布活动数量
export async function releaseActivityCountService(params: ReqReleaseActivityCount) {
  return simpleObjectService<ReqReleaseActivityCount, ResReleaseActivityCount, any>(
    API_MEMBERLIST_RELEASEACTIVITY,
    params,
  );
}

// 发布文章数量
export async function releaseArticleCountService(params: ReqReleaseArticleCount) {
  return simpleObjectService<ReqReleaseArticleCount, ResReleaseArticleCount, any>(
    API_MEMBERLIST_RELEASEARTICLE,
    params,
  );
}

// 参与活动数
export async function participateActivityCountService(params: ReqParticipateActivityCount) {
  return simpleObjectService<ReqParticipateActivityCount, ResParticipateActivityCount, any>(
    API_MEMBERLIST_PARTICIPATEACTIVITY,
    params,
  );
}

// 获取会员信息
export async function getInfoMemberListService(params: ReqMemberListGetInfo) {
  return simpleObjectService<ReqMemberListGetInfo, ResMemberListGetInfo, MemberListDto>(
    API_MEMBERLIST_GETINFO,
    params,
  );
}
